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xJusK/YmNRirALyQTBZ8xZb/ATBLnn
A/XY19+s6FM8XCfWpiTTLIKdi5dDTV1bH0V+8JJFTclE
-----END RSA PRIVATE KEY-----`

// var pk = `-----BEGIN PUBLIC KEY-----
// MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXQA31athdyKAyy1ACbtqvFzQi
// 7cKBdW7Q1vNW4ukQXsA/Bb5NNquU5bg+eEqvlVgNEgFlRHaBYMidrYo126B53BJD
// SREhbkrLogA+ikh2z3+q9deNX+5w5g3i0iOaQIABJVF3XGLv1UMH/DIt+MJiV6Lz
// VxqYgYmln5UUYARK/QIDAQAB
// -----END PUBLIC KEY-----`

var pk = `-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALyJtdMYUjfFs5cATPR9uC5/yY8DUe7k
o68Dj2czS58ZlJbL+nPsA7OcDzRPRSkw6dUYVo3w2uv/ZD+5oMYxIrcCAwEAAQ==
-----END PUBLIC KEY-----`

var pr = `-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCXQA31athdyKAyy1ACbtqvFzQi7cKBdW7Q1vNW4ukQXsA/Bb5N
NquU5bg+eEqvlVgNEgFlRHaBYMidrYo126B53BJDSREhbkrLogA+ikh2z3+q9deN
X+5w5g3i0iOaQIABJVF3XGLv1UMH/DIt+MJiV6LzVxqYgYmln5UUYARK/QIDAQAB
An91G9FmmZqOPDnNuuqSEnDobVltINTLim/pR1trGqXJQkOy1Mz4pCR+wCYnFgRa
mxgOQAM0IsxtPgqCUJ0YNP79avTeby8Ur3Rzfm53JkmTYAhcc3g7v298B2dxJ3Yy
1MtP0S9rG7Fa9CMN3B+qm71nqL3yVAvJBTRoCDObGTzRAkEAtmpDh2+hMWm+/0P9
BSlxFU/XEtBD3Eu8PLYlyfDA1ibbmAuuExzKBrmTBi9selH8G4/aP4zZwaLvYMHg
qDgeeQJBANRDcJZL/ZtTac6Jzeu9e2vfHHHkaMd2jUwBfq86P7Z19CM8sSsd+YXd
ij8KfYFThAz8RezCj3JHUFL+RT9oH6UCQQCdSWEy3bkSv0h2GGyJz+L26mHbkgKB
aDhF7RUGW/YacWT1ZFTTnAZC6C5yrd+OVTTZmx8nns6AXXqkZmfNBJ6ZAkEAhSRY
Nq4rwYYs1BS0Sa5tAFjOatIutw6xyn8Vi6wp0rViEcg8CSOgJEu2L5zQ5JISPmLv
KXdQqwn4ZFaB8SfK0QJAGvXcq02eL7oYvMcyTbHg9gzFpKl2gTo529eB34F71yr9
Y0t1KqigHi/gT6g6lx1cWPqHT2WbxyalRyaxKXVkhQ==
-----END RSA PRIVATE KEY-----`

var jsrsasign = require('jsrsasign')

let src = "{我是测试明文}";

// 加密
let pub = jsrsasign.KEYUTIL.getKey(pk);
console.log(pub)
let enc = jsrsasign.KJUR.crypto.Cipher.encrypt(src, pub);
console.log(`公钥加密结果：${enc}`);
// jsrsasign.hextob64(enc);
console.log(jsrsasign.hextob64(enc));

// 解密
let prv = jsrsasign.KEYUTIL.getKey(pr);
let dec = jsrsasign.KJUR.crypto.Cipher.decrypt(enc, prv);
console.log(`私钥解密结果：${dec}`);


